#pragma once

#include <math.h>

struct point
{
	float x, y;
	point(): x(0), y(0){}
	point(int x, int y): x((float)x), y((float)y){}
	point(float x, float y): x(x), y(y){}

	void add(point const & p)
	{
		x += p.x;
		y += p.y;
	}
	// operator / (float)
	point quotient(float const & f) const
	{
		return point(x/f, y/f);
	}
	// operator /= (float)
	void divide(float const & f)
	{
		x /= f;
		y /= f;
	}
	void multiply(float const & f)
	{
		x *= f;
		y *= f;
	}
	point difference(point const & p)
	{
		return point(x-p.x, y-p.y);
	}
	float getLength()
	{
		return sqrt(x*x+y*y);
	}
	void normalize()
	{
		return divide(getLength());
	}
	void setLength(float const & f)
	{
		normalize();
		multiply(f);
	}
};